<?php

namespace app\Api\event;

use think\Controller;
use think\Loader;

class Order extends Controller
{
    public function getList()
    {
    	return \app\api\controller\Index::$api_user->getOrders($this->request->param('querys/a', []));
    }

    public function getUnpayOrderList()
    {
        return \app\api\controller\Index::$api_user->getOrders(['stage' => 0]);
    }

    public function getPayOrderList()
    {
        return \app\api\controller\Index::$api_user->getOrders(['stage' => 1]);
    }

    public function getDoneOrderList()
    {
        return \app\api\controller\Index::$api_user->getOrders(['stage' => 3]);
    }

    public function getInfo()
    {
        return \app\api\controller\Index::$api_user->getOrder($this->request->param('no'));      
    }

    public function getCreate()
    {
        $caravan_id     = $this->request->param('id');
        $take_car_date  = $this->request->param('sdate');
        $leave_car_date = $this->request->param('edate');
        $other          = $this->request->param('other/a', []);

        return \app\api\controller\Index::$api_user->createOrder($caravan_id, $take_car_date, $leave_car_date, $other);
    }

    public function getCancelOrder()
    {
        return \app\api\controller\Index::$api_user->cancelOrder($this->request->param('no'));
    }
}
